<%inherit file="base.html"/>

<%def name="head()">
<script src="/static/js/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="/static/js/datepicker.css">
   <script>
    $(document).ready(function(){
        $("#query_begin_time").datepicker();
        $("#query_end_time").datepicker();
    });
   </script>
</%def>

<%def name="body()">
<section class="content">
    <div class="box box-primary">
        <div class="box-header">
        <i class="fa fa-hdd-o"></i> <h3 class="box-title">操作日志查询</h3></div>
        <div class="box-body">
            <div class="container">
        <form id="query_form" class="form-horizontal form-well" role="form" action="/admin/operate/log" method="post">
                ${xsrf_form_html()}
            <div class="form-group">
                <label for="opr_name" class="col-md-2 control-label">操作员名</label>
                <div class="col-md-3">
                    <input type="text" id="opr_name" name="opr_name" class="form-control" value="${opr_name or ''}">
                </div>
                <label for="keyword" class="col-md-2 control-label">关键字</label>
                <div class="col-md-3">
                    <input type="text" id="keyword" name="keyword" class="form-control" value="${(keyword or '').decode("utf-8")}">
                </div>
            </div>
            <div class="form-group">
                <label for="query_begin_time" class="col-md-2 control-label">开始时间</label>

                <div class="col-md-3">
                    <input type="text" id="query_begin_time" name="query_begin_time" value="${query_begin_time or ''}" class="form-control form_datetime"  >
                </div>
                 <label for="query_end_time" class="col-md-2 control-label">结束时间</label>
                <div class="col-md-3">
                    <input type="text" id="query_end_time" name="query_end_time" value="${query_end_time or ''}"  class="form-control form_datetime">
                </div>
            </div>
            <div class="form-group">
                <div class="col-md-offset-5 col-md-7">
                    <button type="submit" class="btn btn-primary">查询</button>
                </div>
            </div>
        </form>

        <table class="table table-hover">
            <thead>
            <tr>
                <th width="10%">操作员</th>
                <th width="10%">操作员ip</th>
                <th width="20%">操作时间</th>
                <th width="60%">操作描述</th>
            </tr>
            </thead>
            <tbody>
            % for opslog in page_data.result:
            <tr>
                <td>${opslog.operator_name}</td>
                <td>${opslog.operate_ip}</td>
                <td>${opslog.operate_time}</td>
                <td>${opslog.operate_desc and opslog.operate_desc[:512] or ''}</td>
            </tr>
            % endfor
            </tbody>
        </table>
        ${page_data.render(form_id="query_form")}
    </div>
</div>
        </div>
</section>

</%def>
